/*
 * @features: 主要功能
 * @description: 内容说明
 * @Date: 2021-09-07 09:46:18
 * @Author: judu233(769471424@qq.com)
 * @LastEditTime: 2021-10-05 13:08:49
 * @LastEditors: judu233
 */
import { _decorator } from "cc";
import { ProxyOb } from "./Core/ProxyOb";
import VmParent from "./Core/VmParent";

const { ccclass, property } =_decorator;

@ccclass
export default class DemoVMParent extends VmParent {

    data = {
        a: 1,
        b: 0,
        c: 0,
        dd:23
    }

    start() {
    }

    update(dt) {
        this.data.a += 1;

        if (this.data.a >= 60) {
            this.data.b += 1;
            this.data.a = 0;
        }

        if (this.data.b >= 60) {
            this.data.c += 1;
            this.data.b = 0;
        }
    }
}

export module GlobalDataModuler {
    export class GlobalData {
        static defaultName: string = 'GlobalData默认的全局名字';
        static info: string = 'xin';
        static gold: number = 0;
        static diamond: number = 199000;
        static progressMin: number = -500;
        static progress: number = 500;
        static progressMax: number = 1000;
        static index : number = 0;
        static start = 2;
        static isCheck = false;
        static spChangeIndex = 0;
        static curCheck = 'None';
        static check = {
            selectA: true,
            selectB: false,
            selectC: false,
        }
        static obj = {
            progress: 0
        }
        static array = [
            { name: 's1', age: 18, sex: 0 },
            { name: 's2', age: 16, sex: 1 },
            { name: 's3', age: 12, sex: 2 },
        ]
        //菜单状态（代表选择了哪个菜单
        static menu = {
            state: 0
        }
    }

    export class PlayData {
        static defaultName: string = 'PlayData默认的名字';
        static level: number = 0;
        static exp: number = 15255;//exp
        static exp_max: number = 100000;//升级目标exp
        static gold: number = 10000;

        static hp: number = 450;
        static mhp: number = 1500;
        static mp: number = 700;
        static mmp: number = 15000;

        static atk: number = 5;
        static mat: number = 10;
        static def: number = 10;
        static mdf: number = 10;
        static spd: number = 100;
        static luk: number = 5;
        static cri: number = 0; //暴击率

        static skill_point: number = 15;//技能点
        static prop_point: number = 10; //属性点

        static equips = [3, 3, 12, 0, 0, 1, -1] //对应8个装备孔的id编号（会自动索引到需要的数据库）
    }
    /**
     * 局部UI显示内容
     */
    export class HomeUiInfo {
        static bag = {
            sort: 0,
            sort2: 2,
            type: 'all',
        }
        static skill = {
            id: 0,
            pic: 0,
            name: '??',
            level: 0,
            info: '未知'
        }
    }
}
let GlobalProxy = new ProxyOb(GlobalDataModuler.GlobalData, `GlobalData`,);
let PlayerProxy = new ProxyOb(GlobalDataModuler.PlayData, `PlayData`,);
let uiProxy = new ProxyOb(GlobalDataModuler.HomeUiInfo, `HomeUiInfo`,);
